{extend name="public/header" /}
{block name="body"}
<body>
<style>
.showcss{ display:none;}
</style>
{include file="public/common" /}
<fieldset class="layui-elem-field site-demo-button" style="padding:10px;">
    <div class="layui-row">
		<!--  -->
		<form id="form1" class="layui-form layui-form-pane" action="{:url('')}">
			<input type="hidden" name="id" value="{$info.id}">
			<section class="panel panel-padding">
				{if $info['id']!=''}
				<div class="layui-form-item">
					<label class="layui-form-label">导航ID</label>
					<div class="layui-input-inline">
						<input type="text" name="id" value="{$info.id}" disabled class="layui-input">
					</div>
				</div>
				{/if}
				<div class="layui-form-item">
					<label class="layui-form-label">所属栏目</label>
					<div class="layui-input-inline">
						<select name="fid">
							<option value="0">顶级栏目</option>
							{volist name='list' id='vo' key='k'}
							<option value="{$vo.id}" {if condition="$vo.id eq $info.fid"}selected{/if}>{$vo.name}</option>
								{volist name="vo['voo']" id='sub' key='t' empty="暂时没有数据"}
								<option value="{$sub.id}" {if condition="$sub.id eq $info.fid"}selected{/if}>&nbsp;├&nbsp;{$sub.name}</option>
								{/volist}
							{/volist}
						</select>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">名称</label>
					<div class="layui-input-inline">
						<input type="text" name="name" value="{$info.name}" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">类型</label>
					<div class="layui-input-block">
						<input type="radio" name="type" lay-filter="type" {eq name="info.type" value="1"}checked{/eq} title="列表" value="1" checked />
						<input type="radio" name="type" lay-filter="type" {eq name="info.type" value="2"}checked{/eq} title="单页" value="2" />
						<input type="radio" name="type" lay-filter="type" {eq name="info.type" value="3"}checked{/eq} title="外链" value="3" />
					</div>
				</div>
				<div class="layui-form-item showcss" id='action' {if($info['type']==2 || $info['type']==3)}style='display:block'{/if}>
					<label class="layui-form-label">Action</label>
					<div class="layui-input-inline">
						<input type="text" name="action" value="{$info.action}" class="layui-input">
					</div>
					<div class="layui-form-mid layui-word-aux">单页id/外链链接</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">排序</label>
					<div class="layui-input-inline">
						<input type="text" name="sort" value="{$info.sort}" class="layui-input">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">列表模板</label>
					<div class="layui-input-inline">
						<input type="text" name="tpl_list" value="{$info.tpl_list}" class="layui-input">
					</div>
					<div class="layui-form-mid layui-word-aux">默认:list</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">内容模板</label>
					<div class="layui-input-inline">
						<input type="text" name="tpl_page" value="{$info.tpl_page}" class="layui-input">
					</div>
					<div class="layui-form-mid layui-word-aux">默认:page</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">状态</label>
					<div class="layui-input-inline">
						<input type="radio" name="status" {eq name="info.status" value="1"}checked{/eq} title="正常" value="1" checked />
						<input type="radio" name="status" {eq name="info.status" value="2"}checked{/eq} title="禁用" value="2" />
					</div>
				</div>
				
				<div class="layui-input-block">
					<input type="hidden" name="id" type="hidden" value="{$info.id|default=''}">
					<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</section>
		</form>
		<!--  -->
    </div>
</fieldset>
</body>
{/block}
{block name="script"}
<script>
layui.use(['jquery','form','laydate','upload','element'], function(){
	var $ = layui.jquery
	,laydate = layui.laydate
	,upload = layui.upload
	,element = layui.element
	,form = layui.form;	
	
	form.on('radio(type)', function(data){
		console.log(data.value);
		if(data.value==1){
			$('#action').hide();
		}
		if(data.value==2 || data.value==3){
			$('#action').show();
		}
	}); 
	
	form.render();
});
</script>
{/block}